<?php
	class admin extends My_Controller
	{
		function admin()
		{
			parent::__construct();
			$this->load->model('mod_admin','admin');			
		}
		
		function index()
		{
			$data['title']	= lang('RAOVAT_CONTENT_TITLE_ADMIN_LOGIN');
			$this->load->view('admins/login', $data);
		}
		
		function action_login()
		{
			if ($this->input->post('sbmlogin'))
			{
				$username = trim($this->input->post('username'));
				$password = md5('cdraovat'.md5($this->input->post('password')));
				if (!empty($username) && !empty($password))
				{
					$this->admin->login_admin($username, $password);
				}
				else
				{
					$_SESSION["error_loginadmin"] = "Bạn chưa nhập Username | Password";
					redirect(base_url().'adminx');
				}
			}
		}
		
		function index_admin()
		{
			$data['content_admin']	= 'admins/content_admin';
			$this->load->view('admins/template_admin', $data);
		}		
		
		function logout()
		{
			$this->check_logout();
		}
	}